home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trading on the Edge
/
Trading On The Edge - CD-ROM Toolkit (Wayzata Technology)(2031)(1994).bin
/
mac
/
Shared
/
MovingAverage
/
Documentation.txt
next >
Wrap
Text File
|
1992-11-17
|
2KB
|
78 lines
Statistics`MovingAverage`
=========================
Given a list of data, you can calculate means for subsets of the
data. MovingAverage gives such means repetitively for subsequent
subsets of a determined length. The first moving average takes
subsets of length 2, the second takes subsets of length 3, and so
forth. The result of the r moving average is a list of n - r means,
each calculated with r + 1 elements, where n is the length of the
list.
MovingAverage[list, r] give a list of the r^th moving averages
MovingAverage[{list_1, list_2, ...}, r] give the lists of the r^th
moving averages for the columns of the
matrix formed by the given lists
^^Moving average functions^^
This loads the package.
In[1]:= <<Statistics`MovingAverage`
Here is a data set where the data points are represented by symbols.
In[2]:= data = {a, b, c, d, e, f}
Out[2]= {a, b, c, d, e, f}
This is the second moving average.
In[3]:= MovingAverage[data,2]
a + b + c b + c + d c + d + e d + e + f
Out[3]= {---------, ---------, ---------, ---------}
3 3 3 3
You can use a matrix of data as an argument for MovingAverage to
get lists of the r moving averages corresponding to subsets from
each column of data.
This is a new set of data in the form of a matrix.
In[4]:= data = {{a,b,c},{d,e,f},{g,h,i}}
Out[4]= {{a, b, c}, {d, e, f}, {g, h, i}}
Here are the first moving averages. The first list includes the
means from the first subset for each column. The second subsets
are averaged in the second list.
In[5]:= MovingAverage[data,1]
a + d b + e c + f
Out[5]= {{-----, -----, -----},
2 2 2
d + g e + h f + i
{-----, -----, -----}}
2 2 2